
<%@page import="entities.OderFood"%>
<%@page import="java.util.Date"%>
<%@page import="entities.Customers"%>
<%@page import="java.util.List"%>
<%@page import="session.ShowAllOrderLocal"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.naming.Context"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tunga Restaurant</title>        
    </head>
    <body>
        <h1 style="color: #7A0402" align="center">Tunga Restaurant</h1>
        <center>
            <div class="outer">
                <!--Header end-->
                <div id="header">
                    <h2 align="center" style="color: 7A0402">Report Order Details</h2>
                </div>
                <%
                            if (request.getParameter("date1") != null && request.getParameter("date1") != "" && request.getParameter("date2") != null && request.getParameter("date2") != "") {
                                Date date1 = new Date(request.getParameter("date1"));
                                Date date2 = new Date(request.getParameter("date2"));
                                Context context = new InitialContext();
                                Object obj = context.lookup("ShowAllOrderJNDI");
                                ShowAllOrderLocal local = (ShowAllOrderLocal) obj;
                                List<OderFood> ticlist = local.reportShowBookRoom(date1, date2);
                                if (ticlist.size() == 0) {
                %>
                <h3>No content!</h3>
                <%                                } else {
                                    request.setAttribute("CTICKETBOOKING", ticlist);
                                }
                            }
                %>
                <!--Top nav end-->
                <div style="clear:left"></div>
                <div id="outer2">
                    <div id="content" align="center">
                        <br>
                        <div id="main">
                            <c:set var="list" value="${requestScope.CTICKETBOOKING}"/>
                            <c:set var="totalprice" value="${0}"/>
                            <c:if test="${not empty list}">
                                <div align="center">
                                    <table align="center" border="0" class="fixtable">
                                        <th>UserName</th>
                                        <th>Date Time</th>
                                        <th>Total Price</th>
                                        <c:forEach var="rows" items="${list}">                                            
                                            <tr>
                                                <td>${rows.customers.custID}</td>
                                                <td>${rows.dateTime}</td>
                                                <td>$ ${rows.totalPrice}</td>
                                            </tr>
                                            <c:set var="totalprice" value="${totalprice + rows.totalPrice}" />
                                        </c:forEach>
                                    </table>
                                    <h3 style="color: #7A0402" align="center">Total Price : $ ${totalprice}</h3>
                                </div>
                            </c:if>
                        </div>
                    </div>
                </div>                
                <!--Bottom part-->
            </div>
        </center>
    </body>
</html>
